package org.zachary.creditbusiness.hotel.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.zachary.creditbusiness.hotel.entity.RoomType;
import org.zachary.creditbusiness.hotel.exception.BusinessException;
import org.zachary.creditbusiness.hotel.service.RoomTypeService;

import java.util.List;
@RestController
@RequestMapping("/hotels/{hotelId}/room-types")
@Api(tags = "房型模块")
public class RoomTypeController {

    private final RoomTypeService roomTypeService;

    @Autowired
    public RoomTypeController(RoomTypeService roomTypeService) {
        this.roomTypeService = roomTypeService;
    }

    @ApiOperation("获取指定酒店的所有房型")
    @GetMapping
    public List<RoomType> listByHotel(@PathVariable("hotelId") Integer hotelId) {
        return roomTypeService.getByHotelId(hotelId);
    }
}
